<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
	<title><s:text name="pl.grabar.clinic.client.web.admin.users.views.user"/></title>
	<link href="${pageContext.request.contextPath}/static/global/js/jquery-multiple-select/multiple-select.css" rel="stylesheet"/>
	<script type="text/javascript" src="${pageContext.request.contextPath}/static/global/js/jquery-multiple-select/jquery.multiple.select.js"></script>
	<style type="text/css">

	</style>
	<script type="text/javascript">
		actionType = true;
	</script>
</head>
<body>
	<h1>
	<s:if test="userId != null && !userId.isEmpty()">
			<s:text name="pl.grabar.clinic.client.web.admin.users.views.edit.edit-user"> 
				<s:param value="existingUser.firstName"/>
				<s:param value="existingUser.lastName"/>
			</s:text>
		</s:if>
		<s:else>
			<s:text name="pl.grabar.clinic.client.web.admin.users.views.edit.new-user"/>
		</s:else>
	</h1>
	<s:form namespace="/admin/users" action="saveReceptionist">
		<s:hidden id="userId" name="userId"/>
		<s:if test="userId != null && !userId.isEmpty()">
			<s:textfield name="userTypes[receptionist.userType]" readonly="true" label="%{getText('pl.grabar.clinic.client.web.labels.user-type')}"/>
			<br></br>
			<s:textfield readonly="true" name="receptionist.login" label="%{getText('pl.grabar.clinic.client.web.labels.login')}"/>
			<script type="text/javascript">
				actionType = false;
			</script>			
		</s:if>
		<s:else>
			<s:textfield name="userTypes[receptionist.userType]" readonly="true" label="%{getText('pl.grabar.clinic.client.web.labels.user-type')}"/>
			<br></br>
			<s:textfield readonly="false" name="receptionist.login" label="%{getText('pl.grabar.clinic.client.web.labels.login')}"/>
		</s:else>
		<s:password name="receptionist.password" label="%{getText('pl.grabar.clinic.client.web.labels.password')}"/>
		<s:password name="passwordMatch" value="receptionist.password" label="%{getText('pl.grabar.clinic.client.web.labels.password-repeat')}"/>
		<br></br>
		<s:textfield name="receptionist.firstName" label="%{getText('pl.grabar.clinic.client.web.labels.firstname')}"/>
		<s:textfield name="receptionist.lastName" label="%{getText('pl.grabar.clinic.client.web.labels.lastname')}"/>
		<br></br>
		<s:textfield name="receptionist.email" label="%{getText('pl.grabar.clinic.client.web.labels.email')}"/>
		<s:textfield name="receptionist.phoneNumber" label="%{getText('pl.grabar.clinic.client.web.labels.phone-number')}"/>
		<br></br>
		<br></br>
		<s:select list="possiblePermissions" name="receptionist.permissions[0].name" id="idSelectedPermission" label="%{getText('pl.grabar.clinic.client.web.labels.permissions')}" multiple="false" style="width: 270px;" />
		<script type="text/javascript">
		$("#idSelectedPermission").multipleSelect({
			unselectRadio: actionType,
			single: true,
			onClick: function(view) {
				$("#idSelectedPermission").multipleSelect({unselectRadio: false});
				$("#idSelectedPermission").multipleSelect("refresh");
				$("#idSelectedPermission").multipleSelect('setSelects', [view.value ]);
	        },
		});
	   	</script>
		
		<br></br>
		<s:submit value="%{getText('pl.grabar.clinic.client.web.buttons.save')}"/>
	</s:form>
</body>
</html>